/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.util.List;

/**
 *
 * @author think
 */
public class CommandResult {

    private int rc;
    private String output;
    private List<String> data;
    
    public CommandResult(){
        this.rc = -1;
    }


    public CommandResult(int result, String output) {
        this.rc = result;
        this.output = output;
    }
    
    public CommandResult(int rc, String output, List<String> data){
        this.rc = rc;
        this.output = output;
        this.data = data;
    }

    public List<String> getData(){
        return this.data;
    }

    public boolean isSucceed() {
        return this.getRc() == 0 ? true : false;
    }

    public String getData(int index){
        return this.getData().get(index);
    }

    public void setRc(int rc){
        this.rc = rc;
    }

    public int getRc(){
        return this.rc;
    }

    public void setData(String[] output){
        this.setData(output);
    }

    /**
     * @return the output
     */
    public String getOutput() {
        return output;
    }

    /**
     * @param output the output to set
     */
    public void setOutput(String output) {
        this.output = output;
    }

}
